package com.qy.service.impl;

import java.io.File;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.qy.dao.UserDao;
import com.qy.model.PageModel;
import com.qy.service.BaseService;

@Service("baseService")
@Transactional
public class BaseServiceImpl<T> implements BaseService<T> {
	@Autowired
	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	@Override
	public void save(T t) throws Exception {
		// TODO Auto-generated method stub
		userDao.save(t);
	}

	@Override
	public List<T> select(String hql, Object[] object) throws Exception {
		// TODO Auto-generated method stub
		return userDao.select(hql, object);
	}

	@Override
	public void delete(T t) throws Exception {
		// TODO Auto-generated method stub
		userDao.delete(t);
	}

	@Override
	public List<T> selectAllByPage(String hql, Object[] obj, PageModel page) throws Exception {
		// TODO Auto-generated method stub
		return userDao.selectAllByPage(hql, obj, page);
		
	}

	@Override
	public void execute(String hql, List<Object> list) throws Exception {
		// TODO Auto-generated method stub
		userDao.execute(hql,list);
	}

	@Override
	public String saveFile(String fileFileName, File file) throws Exception {
		// TODO Auto-generated method stub
		return userDao.saveFile(fileFileName, file);
	}
}
